package microservicedemo.bookservice.mapper;


import microservicedemo.bookservice.po.Book;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface BookMapper {
    @Insert("insert into book(title,author,publisher) values(#{title},#{author},#{publisher})")
    void addBook(Book book);

    @Delete("delete from book where title=#{title} and author=#{author}")
    void delBook(Book book);

    @Update("update book set title=#{title},author=#{author},publisher=#{publisher} where id=#{id}")
    void editBook(Book book);

    @Select("select * from book where title=#{title}")
    Book getByTitle(String title);

    @Select("select * from book where author=#{author}")
    Book getByAuthor(String author);
}
